/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Clases;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

    

/**
 *
 * @author Gustavo
 */
public class CargaPresion {
  
    public CargaPresion()
    {
    
    }
    
    public ListaPresion  Lectura()
    {
       ListaPresion lista=new ListaPresion();
       
       String csvFile= new File("").getAbsolutePath()+"\\Tablas\\Presion.csv";
        System.out.println(csvFile);
                BufferedReader br = null;
	String line = "";
	String cvsSplitBy = ",";
 
	try {
 
		br = new BufferedReader(new FileReader(csvFile));
		while ((line = br.readLine()) != null) {
 
		        // use comma as separator
			String[] item = line.split(cvsSplitBy);			
                        lista.Insertar(item[0] , item[1] );
                        
		}
                lista.imprimir();
 
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	} catch (IOException e) {
		e.printStackTrace();
	} finally {
		if (br != null) {
			try {
				br.close();
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
	}
 
	System.out.println("Lista Leida completamente!");
        System.out.println("Encontro:"+lista.BuscarPresion("4600"));
        
        return lista;
        
  }

 

}

    
    

